{include file="../../../application/admin/view/public/head" /}

<!-- 布 局 框 架 -->
<div class="layui-layout layui-layout-admin">
    <div class="layui-header">
        <!-- 顶 部 左 侧 功 能 -->
        <ul class="layui-nav layui-layout-left">
            <li class="collaspe layui-nav-item"><a href="#" class="layui-icon layui-icon-shrink-right"></a></li>
            <li class="refresh layui-nav-item"><a href="#" class="layui-icon layui-icon-refresh-1" loading = 600></a></li>
        </ul>
        <!-- 多 系 统 菜 单 -->
        <div id="control" class="layui-layout-control"></div>
        <!-- 顶 部 右 侧 菜 单 -->
        <ul class="layui-nav layui-layout-right">
            <li class="layui-nav-item layui-hide-xs"><a href="#" class="fullScreen layui-icon layui-icon-screen-full"></a></li>
            <!-- <li class="layui-nav-item layui-hide-xs"><a href="http://www.pearadmin.com" class="layui-icon layui-icon-website"></a></li> -->
            <li class="layui-nav-item layui-hide-xs message"></li>
            <li class="layui-nav-item user">
                <!-- 头 像 -->
                <a href="javascript:;">
                    <!-- <img src="admin/images/avatar.jpg" class="layui-nav-img"> -->
                    <span class="layui-nav-img">
                        {:lang('opt')}
                        <i href="#" class="layui-icon layui-icon-down"></i>
                    </span>
                    
                </a>
                
                <!-- 功 能 菜 单 -->
                <dl class="layui-nav-child">
                    <dd><a href="javascript:void(0);" id="lockScreen" class="clearCache">{:lang('admin/index/index/menu_lock')}</a></dd>
                    <dd><a href="{:url('index/clear')}" class="lock">{:lang('admin/index/index/menu_cache_clear')}</a></dd>
                    <dd><a href="{:url('index/logout')}" class="logout">{:lang('admin/index/index/menu_logout')}</a></dd>
                </dl>
            </li>
            <li class="layui-nav-item layui-hide-xs">
                <a href="__ROOT__/" target="_blank">{:lang('admin/index/index/menu_index')}</a>
            </li>
            <!-- 主 题 配 置 -->
            <li class="layui-nav-item setting"><a href="#" class="layui-icon layui-icon-more-vertical"></a></li>
        </ul>
    </div>
    <!-- 侧 边 区 域 -->
    <div class="layui-side layui-bg-black">
        <!-- 菜 单 顶 部 -->
        <div class="layui-logo">
            <!-- 图 标 -->
            <img class="logo"></img>
            <!-- 标 题 -->
            <span class="title"></span>
        </div>
        <!-- 菜 单 内 容 -->
        <div class="layui-side-scroll">
            <div id="sideMenu"></div>
        </div>
    </div>
    <!-- 视 图 页 面 -->
    <div class="layui-body">
        <!-- 内 容 页 面 -->
        <div id="content"></div>
    </div>
    <!-- 遮 盖 层 -->
    <div class="pear-cover"></div>
    <!-- 加 载 动 画-->
    <div class="loader-main">
        <img src="__STATIC__/images/other/login-loading.gif" alt="">
        <!-- <div class="loader"></div> -->
    </div>
    <!-- js中的多语言处理 -->
    <div class="hidden-element"></div>
</div>

{include file="../../../application/admin/view/public/foot" /}
<!-- 初始化pear-admin，生成菜单 -->
<script>
    // 国际化，js中的多语言文本
    window.i18n = {
        languege_change_url: "{:url('index/lang')}",
        whole_style: "{:lang('admin/system/whole_style')}",
        theme_color: "{:lang('admin/system/theme_color')}",
        lang_change: "{:lang('admin/system/lang_change')}",
        close_current: "{:lang('admin/system/close_current')}",
        close_other: "{:lang('admin/system/close_other')}",
        close_all: "{:lang('admin/system/close_all')}",
        close: "{:lang('close')}",
    }
    // 国际化，兼容iframe中的情况
    localStorage.setItem('tip10',"{:lang('admin/public/index/title10')}")
    localStorage.setItem('tip11',"{:lang('admin/public/index/title11')}")
    localStorage.setItem('tip12',"{:lang('admin/public/index/title12')}")
    localStorage.setItem('tip13',"{:lang('admin/public/index/title13')}")
    localStorage.setItem('tip14',"{:lang('admin/public/index/title14')}")
    localStorage.setItem('tip15',"{:lang('admin/public/index/title15')}")
    localStorage.setItem('tip16',"{:lang('admin/public/index/title16')}")
    localStorage.setItem('tip17',"{:lang('admin/public/index/title17')}")
    localStorage.setItem('tip18',"{:lang('admin/public/index/title18')}")
    localStorage.setItem('tip19',"{:lang('admin/public/index/title19')}")
    localStorage.setItem('tip20',"{:lang('admin/public/index/title20')}")
    localStorage.setItem('tip21',"{:lang('admin/public/index/title21')}")
    localStorage.setItem('tip22',"{:lang('admin/public/index/title22')}")
    localStorage.setItem('tip23',"{:lang('admin/public/index/title23')}")
    localStorage.setItem('tip24',"{:lang('admin/public/index/title24')}")
    localStorage.setItem('language_current','<?=$language_current?>')
    
    var obj = <?=json_encode($menus)?>;
    var arr = obj2Arr(obj);
    var parsedArr = originDataParse2PearAdminMenu(arr);
    var language_current = '<?=$language_current?>';
    var language_list = <?=json_encode($language_list)?>;
    layui.use(['admin','jquery','convert','popup'], function() {
				var admin = layui.admin;
				var $ = layui.jquery;
				var convert = layui.convert;
				var popup = layui.popup;
                
                // 传入菜单数据
                pearConfig.menu.data = parsedArr;
                // 传入多语言选项
                pearConfig.language_list = language_list,
                pearConfig.language_current = language_current,

                // admin.setAvatar("__STATIC__/admin/images/avatar.jpg","就眠仪式");
				admin.render(pearConfig);
				
				// 初始化消息回调
				// admin.message();
				
				// 重写消息回调 [消息列表点击事件]
				// admin.message(function(id, title, context, form) {});
			})
</script>

<script>
    // window.localStorage.clear();
</script>

<script type="text/javascript">
    $(function(){
        setInterval("checkCache()", 30*1000);
    });

    //检查缓存并保持登录状态
    function checkCache(){
        $.ajax({
            url: "{:url('checkcache')}",
            cache: false,
            success: function(r){
                if(r=='haved'){
                    layer.msg('{:lang("admin/index/cache_data")}', {time: 3000});
                }
            }
        });
    }
    // iframe中跳转到登录页，外层框架要刷新
    window.addEventListener('message',function(event){
        if(event.data=='reload'){
            location.reload();
        }
    })
</script>

</body>
</html>